package cn.wolfcode.shop.msg;

import cn.wolfcode.shop.common.CodeMsg;

import java.text.MessageFormat;

/**
 * 定义这个服务中错误状态码和消息的映射
 */
public class MemberServerCodeMsg extends CodeMsg {
    public MemberServerCodeMsg(Integer code, String msg) {
        super(code, msg);
    }
    public static final MemberServerCodeMsg USER_PARAM_ERROR =
            new MemberServerCodeMsg(500108, "参数输入错误：{0}");

    public MemberServerCodeMsg failParam(String msg) {
        // MessageFormat:将传过来的信息填入到占位符当中去，会根据 msg 变化的错误
        return new MemberServerCodeMsg(this.getCode(), MessageFormat.format(this.getMsg(), msg));
    }



    public static final MemberServerCodeMsg DEFAULT_ERROR = new MemberServerCodeMsg(500100, "会员服务繁忙");
    public static final MemberServerCodeMsg PHONE_EXIST_ERROR = new MemberServerCodeMsg(500101, "手机号码已存在");
    public static final MemberServerCodeMsg PHONE_EMPTY_ERROR = new MemberServerCodeMsg(500102, "手机号码不能为空");
    public static final MemberServerCodeMsg NICKNAME_EMPTY_ERROR = new MemberServerCodeMsg(500103, "昵称不能为空");
    public static final MemberServerCodeMsg PASSWORD_EMPTY_ERROR = new MemberServerCodeMsg(500104, "密码不能为空");
    public static final MemberServerCodeMsg RPASSWORD_EMPTY_ERROR = new MemberServerCodeMsg(500105, "确认密码不能为空");
    public static final MemberServerCodeMsg PASSWORD_COMPARE_ERROR = new MemberServerCodeMsg(500106, "两次输入密码不一致");
    public static final MemberServerCodeMsg PASSWORDORID_ERROR = new MemberServerCodeMsg(500107, "用户名或密码错误");


}
